<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代器</title>
</head>
<body>
    <script>
        //声明 一个数组
        const arr = ['唐僧','猪八戒','孙悟空','沙和尚'];
        // for(a of arr){
        //     console.log(a);
        // }
        let it = arr[Symbol.iterator]();
        //调用对象的next方法
        console.log(it.next());
        console.log(it.next());
        console.log(it.next());
        console.log(it.next());
    </script>
</body>
</html>